import settings from '@/config/settings'

// 应用主题色
export const applyTheme = (color) => {
  const style = document.documentElement.style
  style.setProperty('--el-color-primary', color)
  
  // 保存用户选择的主题色
  localStorage.setItem('theme-color', color)
}

// 初始化主题
export const initTheme = () => {
  // 优先使用用户已选择的主题色
  const savedColor = localStorage.getItem('theme-color')
  const themeColor = savedColor || settings.theme.primaryColor
  
  applyTheme(themeColor)
} 